import java.awt.*;

import javax.swing.*;

public class Decision extends Element {

	public Decision(int x, int y,GridPanel parent) {
		super("", x, y,parent);
		statHeight = 40;
		statWidth = 40;
		maxWidth = 2*statWidth;
		maxHeight=2*statHeight;
		setSize(statWidth, statHeight);
		this.width = statWidth;
		this.height = statHeight;
		maxInputCount=-1;
		maxOutputCount=2;

	}

	public void paintComponent(Graphics g) {
		Graphics2D g2d = (Graphics2D) g;
		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_ON);
		g2d.setColor(Color.BLACK);
		g2d.setFont(new Font("Verdana", Font.PLAIN, 20));

		Polygon rhomb = new Polygon();
		rhomb.addPoint(0, height / 2);
		rhomb.addPoint(width / 2, 0);
		rhomb.addPoint(width - 1, height / 2);
		rhomb.addPoint(width / 2, height - 1);
		g2d.drawPolygon(rhomb);
		g2d.setColor(Color.YELLOW);
		g2d.fillPolygon(rhomb);

		if (selected) {
			g2d.setColor(Color.BLACK);
			int[] xP = new int[3];
			int[] yP = new int[3];
			xP[0] = width - 7;
			yP[0] = height;
			xP[1] = width;
			yP[1] = height - 7;
			xP[2] = width;
			yP[2] = height;
			g2d.fillPolygon(xP, yP, 3);
		}
	}
}